<?php

//note 将菜单写缓存，在主页index.php中用到
function write_menu_cache(){
	global $db;
	//一级菜单
	$sql = "SELECT * FROM menu WHERE pid = 0 ORDER BY sort ASC";
	$menu = $db->getAll( $sql );
	
	file_put_contents('../image2/cache/menu_cache.php', serialize( $menu ));
}